package com.tbs.easyhomemoneyserver.utils;

import cn.hutool.core.bean.BeanUtil;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class DtoUtils {
    public static <T, R> R convert(T obj, Class<? extends R> rclass) {
        return BeanUtil.toBean(obj, rclass);
    }
    public static <T, R>  List<R> convertAll(List<T> obj, Class<? extends R> rclass) {

        List<R> arr=new LinkedList<>();

        for(T o:obj)
        {
            arr.add(BeanUtil.toBean(o, rclass));
        }
        return arr;
    }
}
